//
//  CMDBUserCenterProfileViewController.swift
//  CMDB
//
//  Created by 曹桂祥 on 2017/5/6.
//  Copyright © 2017年 CMDB. All rights reserved.
//

import UIKit

class CMDBUserCenterProfileViewController: CMDBUserBaseCenterViewController {
    
    var tableView : CMDBHomeUserProfileTableView!
    
//    var adapters : []

    override func setup() {
        super.setup()
        
        buildTableView()
        
        
        loadRequest()
    }
    
    override func buildTableView() {
        super.buildTableView()
        
        let contentH = CMDB_Screen_Height - KNavBarHeight - CMDB_Screen_Width * 0.5
        
        let contentFrame = CGRect(x: 0, y:  0, width: CMDB_Screen_Width, height: contentH)
        
        tableView = CMDBHomeUserProfileTableView(frame: contentFrame)
        
        tableView.separatorStyle = .None
        
        tableView.showsVerticalScrollIndicator = false
        
        tableView.mDelegate = self
        
        tableView.backgroundColor = UIColor.whiteColor()
        
        view.addSubview(tableView)
        
    }

}

extension CMDBUserCenterProfileViewController{

    func loadRequest(){

        var data = [CMDBProfileModel]()
        
        data.append(CMDBProfileModel(name:"姓名" , profileContent: ["冯磊"]))
        data.append(CMDBProfileModel(name: "曾用名", profileContent: ["冯磊,冯小磊"]))
        data.append(CMDBProfileModel(name: "出生日期", profileContent: ["1989-12-05"]))
        
        data.append(CMDBProfileModel(name: "入行年份", profileContent: ["1970年"]))
        data.append(CMDBProfileModel(name: "外语能力", profileContent: ["英语-日常沟通","日语-专业交流"]))
        data.append(CMDBProfileModel(name: "常住地", profileContent: ["北京"]))
        data.append(CMDBProfileModel(name: "护照有效期", profileContent: ["1989-12-05"]))
        data.append(CMDBProfileModel(name: "身高", profileContent: ["178cm"]))
        data.append(CMDBProfileModel(name: "体重", profileContent: ["52kg"]))
        data.append(CMDBProfileModel(name: "名族", profileContent: ["汉族"]))
        
        tableView.updateDataWithOutReload(data)
        
        tableView.updateCellAdpaters(data, isInsert: false)
        
    }
    
}
